import { Injectable } from '@angular/core';
import {MessageService} from "primeng/api";

@Injectable({
  providedIn: 'root'
})
export class AlertService {

  constructor(private messageService: MessageService) { }

  public showSuccess(info:string) {
    this.messageService.add({ severity: 'success', summary: '成功', detail: info ,life:3000});
  }

 public showInfo(detail:string) {
    this.messageService.add({ severity: 'info', summary: '消息', detail: detail ,life:3000});
  }


  public showWarn(detail:string) {
    this.messageService.add({ severity: 'warn', summary: '警告', detail: detail,life:3000 });
  }

  public  showError(detail:string) {
    this.messageService.add({ severity: 'error', summary: '错误', detail: detail ,life:3000});
  }

  public  showContrast(detail:string) {
    this.messageService.add({ severity: 'contrast', summary: '消息', detail: detail,life:3000 });
  }


  public showSecondary(detail:string) {
    this.messageService.add({ severity: 'secondary', summary: '消息', detail: detail,life:3000});
  }

}
